home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kjs / reference.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.5 KB  |  90 lines

  1. // -*- c-basic-offset: 2 -*-
  2. /*
  3.  *  This file is part of the KDE libraries
  4.  *  Copyright (C) 2003 Apple Computer, Inc
  5.  *
  6.  *  This library is free software; you can redistribute it and/or
  7.  *  modify it under the terms of the GNU Library General Public
  8.  *  License as published by the Free Software Foundation; either
  9.  *  version 2 of the License, or (at your option) any later version.
  10.  *
  11.  *  This library is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  *  Library General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU Library General Public License
  17.  *  along with this library; see the file COPYING.LIB.  If not, write to
  18.  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.  *  Boston, MA 02110-1301, USA.
  20.  *
  21.  */
  22.  
  23. #ifndef _KJS_REFERENCE_H_
  24. #define _KJS_REFERENCE_H_
  25.  
  26. #include "identifier.h"
  27. #include "value.h"
  28.  
  29. namespace KJS {
  30.  
  31. // delme
  32. /**
  33. * Defines a Javascript reference.
  34. */
  35.   class KJS_EXPORT Reference : public Value {
  36. // fixme
  37. /*   class Reference : private Value { */
  38.     friend class ReferenceList;
  39.     friend class ReferenceListIterator;
  40.   public:
  41.     Reference(const Object& b, const Identifier& p);
  42.     Reference(const Object& b, unsigned p);
  43.     Reference(ObjectImp *b, const Identifier& p);
  44.     Reference(ObjectImp *b, unsigned p);
  45.     Reference(const Null& b, const Identifier& p);
  46.     Reference(const Null& b, unsigned p);
  47.     static Reference makeValueReference(const Value& v);
  48.     
  49.     /**
  50.      * Performs the GetBase type conversion operation on this value (ECMA 8.7)
  51.      *
  52.      * Since references are supposed to have an Object or null as their base,
  53.      * this method is guaranteed to return either Null() or an Object value.
  54.      */
  55.     Value getBase(ExecState *exec) const;
  56.  
  57.     /**
  58.      * Performs the GetPropertyName type conversion operation on this value
  59.      * (ECMA 8.7)
  60.      */
  61.     Identifier getPropertyName(ExecState *exec) const;
  62.  
  63.     /**
  64.      * Performs the GetValue type conversion operation on this value
  65.      * (ECMA 8.7.1)
  66.      */
  67.     Value getValue(ExecState *exec) const;
  68.  
  69.     /**
  70.      * Performs the PutValue type conversion operation on this value
  71.      * (ECMA 8.7.1)
  72.      */
  73.     void putValue(ExecState *exec, const Value &w);
  74.     bool deleteValue(ExecState *exec);
  75.  
  76.     bool isMutable();
  77.  
  78.   private:
  79.     Reference();
  80.  
  81.     Value base;
  82.     unsigned propertyNameAsNumber;
  83.     bool baseIsValue;
  84.     bool propertyNameIsNumber;
  85.     mutable Identifier prop;
  86.   };
  87. }
  88.  
  89. #endif
  90.